/*
 * ReactionSystem.h
 *
 *  Created on: 23 Jul 2011
 *      Author: Allan
 */

#ifndef REACTIONSYSTEM_H_
#define REACTIONSYSTEM_H_

// C++ includes
#include <iostream>
#include <vector>
using namespace std;

// Eigen includes
#include <Eigen/Core>
using namespace Eigen;

// C++ includes
#include <Core/Reaction.h>

class ReactionSystem
{
public:
	ReactionSystem();
	
	ReactionSystem(const vector<Reaction>& reactions);
	
	const unsigned
	GetNumReactions() const;
	
	const unsigned
	GetNumSpecies() const;
	
	const vector<Reaction>&
	GetReactions() const;
	
	const vector<string>&
	GetSpecies() const;
	
	const Reaction&
	operator[](unsigned idx) const;
	
	const MatrixXd
	AssembleStoichiometricMatrix(const vector<string>& species) const;
	
	const VectorXd
	EquilibriumConstants(double T, double P) const;
	
	const VectorXd
	ReactionQuotients(const VectorXd& a) const;
	
	const VectorXd
	KineticRates(double T, double P, const VectorXd& n, const VectorXd& a) const;
	
private:
	/// The reactions that compose the reaction system
	vector<Reaction> reactions;
	
	/// The set of all species in the reactions
	vector<string> species;
};

ostream&
operator<<(ostream& out, const ReactionSystem& reaction_system);

#endif /* REACTIONSYSTEM_H_ */

